package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.UserLikeBean;
import com.xuxin.baby.contract.UserCourseContract;
import com.xuxin.baby.contract.UserLikeContract;
import com.xuxin.baby.model.UserCourseModel;
import com.xuxin.baby.model.UserLikeModel;

import org.jetbrains.annotations.Contract;

/**
 * Created by xu_xin
 * Created on 2020/11/19 0019
 * 我的课程
 */
public class UserCoursePresenter implements UserCourseContract.Presenter {
    private final UserCourseModel model;
    private final UserCourseContract.View view;

    public UserCoursePresenter(UserCourseContract.View view) {
        this.view = view;
        model = new UserCourseModel();
    }

    @Override
    public void getCourse(String tenantId, String token, String member, int skipCount) {
        if (null != model) {
            model.getCourse(this, tenantId, token, member, skipCount);
        }
    }

    @Override
    public void onSuccess(UserLikeBean userLikeBean) {
        if (null != view) {
            view.onSuccess(userLikeBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}
